#ifndef MAINFRAME_H
#define MAINFRAME_H

#include <QFrame>
#include "expframe.h"
#include "tunemanualframe.h"
#include "tuneautoframe.h"
#include "crosscalframe.h"
#include "masscalframe.h"
#include "hardwareframe.h"
#include "sequencerunframe.h"
#include "spectrallineframe.h"
#include "masscalreportframe.h"
#include "crosscalreportframe.h"
#include "hexapolecalframe.h"
#include "quantitativesemiframe.h"
#include "tuneautoreportframe.h"

#include "experiment.h"
namespace Ui {
class MainFrame;
}

class MainFrame : public QFrame
{
    Q_OBJECT
    
public:
    explicit MainFrame(QWidget *parent = 0);
    ~MainFrame();
    
    bool IsOpened(QString name);
    void AddTab(ExpFrame *pWidget,QString name);
private slots:
    void on_toolButton_NewExp_clicked();

    void on_toolButton_ManualTune_clicked();

    void on_toolButton_AutoMassCal_clicked();

    void on_toolButton_AutoTune_clicked();

    void on_tabWidgetTask_tabCloseRequested(int index);

    void on_toolButton_InstrumentState_clicked();

    void on_toolButton_NewSpectralLine_clicked();

    void on_toolButton_AutoTuneReport_clicked();

    void on_toolButton_AutoCrossCal_clicked();

    void on_toolButton_HalfMassCal_clicked();

    void on_toolButton_RfCal_clicked();

    void on_toolButton_MassCalReport_clicked();

    void on_toolButton_CrossCalReport_clicked();

    void on_toolButton_OpenExp_clicked();

    void on_toolButton_SaveExp_clicked();

    void on_toolButton_CloseExp_clicked();

    void on_toolButton_OpenSpectralLine_clicked();


    void OnCreateBlankExp();
    void OnCreateExistExp();
    void UpdateExpName(QString);

    void on_toolButton_WorkFlow_clicked();

    void on_toolButton_NetTest_clicked();

private:
    Ui::MainFrame *ui;
    ExpFrame *pExpFrame;
    TuneManualFrame *pTuneManualFrame;
    TuneAutoFrame *pTuneAutoFrame;
    CrossCalFrame *pCrossCalFrame;
    MassCalFrame *pMassCalFrame;
    HardwareFrame *pHardwareFrame;
    SequenceRunFrame *pSequenceRunFrame;
    SpectralLineFrame *pSpectralLineFrame;

    MassCalReportFrame *pMassCalReportFrame;
    CrossCalReportFrame *pCrossCalReportFrame;
    HexaPoleCalFrame *pHexaPoleCalFrame;
    QuantitativeSemiFrame *pQuantitativeSemiFrame;
    TuneAutoReportFrame *pTuneAutoReportFrame;

    Experiment *pExperiment;

    QString GetCurrentWidget();
    int CloseWidget(QString name);
};

#endif // MAINFRAME_H
